$(function() {
	
	$("#perfManage").css("display","block");
	$("#desktop").css('display','block');
	$("#performance").css('display','block');
	$.ajax({
		url: '/api/roleresource/getResByUser?',
		type: 'get',
		data: {'_t': new Date().getTime()},
		success: function(data) {
			// console.info("sidenav.js--",data);
			var statisticsFlag = 0;
			var empFlag = 0;
			var setFlag = 0;
			if(data != null && data.length != 0) {
				$.each(data, function(i, item) {
					var urlArr = item.resUrl.split("/");
					// console.info(i + "----" , urlArr);
					if(urlArr.length == 2) {
						var id = urlArr[1];
						if($("#" + id).length != 0) {
							$("#" + id).css("display", "block");
						}
						//判断各主菜单下是否有子菜单，有为1，无为0
						if(id == "statistics") {
							statisticsFlag = 1;
						}
						if(id == "staff" || id == "organization" || id == "system" ) {
							empFlag = 1;
						}
						if(id == "usermanage" || id == "rolemanage" || id == "resourcemanage" || id == "item"  || id == "accessControl") {
							setFlag = 1;
						}
					}

				});
				if(statisticsFlag == 1) {
					$("#statisticsManage").css("display","block");
				}

				if(empFlag == 1) {
					$("#empManage").css("display","block");
				}

				if(setFlag == 1) {
					$("#SetManage").css("display","block");
				}
			}
		}
	});
})
